Advertisement
Guest User

OpenCV

a guest
Jun 3rd, 2015
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. Continued from the above discussion, I draft the following codes to form a Bow-based feature representation. I try to use three feature descriptors to extract the keypoints of characters. And then use Hog feature descriptors to describe these keypoints for the further training in Bow and SVM.
  2.  
  3. vector<Point2f> pts1,pts2,pts3;
  4.  
  5. ORB detector1;
  6.  
  7. vector<KeyPoint> keypoints1;
  8. detector1.detect(src, keypoints1);
  9. keyPointsToPoints(keypoints1, pts1);
  10.  
  11. GoodFeaturesToTrackDetector detector2;
  12. vector<KeyPoint> keypoints2;
  13. detector2.detect(src, keypoints2);
  14. keyPointsToPoints(keypoints2, pts2);
  15.  
  16. DenseFeatureDetector detector3;
  17. vector<KeyPoint> keypoints3;
  18. detector3.detect(src, keypoints3);
  19. keyPointsToPoints(keypoints3, pts3);
  20.  
  21. vector<float> descriptors1,descriptors2,descriptors3;
  22.  
  23. HOGDescriptor hog;
  24.  
  25. hog.compute(src,descriptors1,Size(3,3),Size(1,1),pts1);
  26. hog.compute(src,descriptors2,Size(3,3),Size(1,1),pts2);
  27. hog.compute(src,descriptors3,Size(3,3),Size(1,1),pts3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement